using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using Utils;
namespace Utils.WebFramework
{
    public class Session : NameValues
    {
        internal Session()
        {

        }

        internal void Mark() 
        {
            dateTime = DateTime.Now.AddSeconds(Framework.GetFramework().SessionExpire);
        }

        internal DateTime dateTime = DateTime.Now;
    }

    class SessionManager
    {
        private SessionManager()
        {

        }

        public static SessionManager GetSessionManager()
        {
            return sessionManager;
        }


        private static SessionManager sessionManager = new SessionManager();

        internal void RemoveSession(string sid)
        {
            sessions.Remove(sid);
        }

        internal Session GetSession(string sid)
        {
            Session session = (Session)sessions[sid];

            if (session == null)
            {
                session = new Session();
                sessions[sid] = session;
            }

            return session;
        }

        private Hashtable sessions = new Hashtable();
    }
}
